package com.example.mygame.controller;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.TextView;

import com.example.mygame.R;

public class MainActivity extends AppCompatActivity {


    public MainActivity() {
        mainActivity = this;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        tvScore = (TextView) findViewById(R.id.tvScore);
        tvFootSize = (TextView) findViewById(R.id.tvFootSize);

    }

    public void clearScore() {
        score = 0;
        showScore();
    }

    public void showScore() {
        String scoreStr = score + "";
        String substring = scoreStr.substring(0, scoreStr.length() - 1);
        tvScore.setTextSize(25);
        tvFootSize.setTextSize(25);
        tvScore.setText(substring);
        tvFootSize.setText(footSize + "");


    }

    public void addScore(int s) {
        footSize++;
        score += s;
        showScore();
    }

    public static MainActivity getMainActivity() {
        return mainActivity;
    }

    public static void setMainActivity(MainActivity mainActivity) {
        MainActivity.mainActivity = mainActivity;
    }

    public void setScore(int score) {
        this.score = score;
    }

    private int score = 0;
    private TextView tvScore;
    private static MainActivity mainActivity = null;
    private TextView tvFootSize;

    private int footSize = 0;
}